home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Guided Tour of Multimedia (Second Edition)
/
The Guided Tour of Multimedia (Second Edition).iso
/
trials
/
director
/
evalcopy
/
director.z
/
LUCK.DIR
/
00001_Script_1
next >
Wrap
Text File
|
1994-07-11
|
12KB
|
352 lines
-- Luck Movie Script Rev 3
-- *********************************************************************
-- The startMovie handler is called automatically when the movie is started
on startMovie
--We are going to to keep two lists that are used by other handlers
--so we store them in global variables
global masterList, artistList
--These statements delete any previous values held by the
--variables masteList, artistList and defaultList. This also establishes
--these variables to contain lists.
set masterList to []
set artistList to []
set defaultList to []
--These statements set the text size of all the
--text fields used to 12point and make the bid
--and name entry fields blank, erasing any previous input.
set the textSize of field "name entry field" = 12
set the textSize of field "bid entry field" = 12
set the textSize of field "display winning bids" = 12
set the textSize of field "display winner names" = 12
put " "into field "name entry field"
put " "into field "bid entry field"
--These statements add all the designers to a list
--called designerList. designerList is actually a list
--within a list; each entry for a designer contains a two-member list
--made up of the designer's name and a code for the designer.
--The designer code is also used in the frame markers.
add artistlist, ["Andrew Belschner","Bel0"]
add artistlist, ["Richard Brayton","Bray0"]
add artistlist, ["Glenn Gee","Gee0"]
add artistlist, ["Brian Kenneth Graham","Grah0"]
add artistlist, ["Brian Kane","Kane0"]
add artistlist, ["Alan & Joy Ohashi","Oha0"]
--This statement creates a three member list to provide default bidders.
--Again this is a list containing other lists.
set defaultlist to [["John Doe",300],["Joe Smith",500],["Jane Jones",450]]
--These statements step through the artist lists to make a master list containing
--all the bids and bidders in the default list as if these bidders had
--entered bids for these designer's work
repeat with artistnumb = 1 to count(artistlist)
--These statements extract the designer (artist) code from
--each entry in the artist list.
set currentArtist to getAt(artistlist, artistnumb)
set currentArtistCode to getAt(currentArtist, 2)
--These statements add to a master list entries for each of the members
--of the default list for each of the artist. Therefore we have a master list
--where John Doe, Joe Smith, and Jane Jones all bid the same amount for each of
--the designer's work.
repeat with defaultnumb = 1 to count(defaultlist)
set currentDefault to getAt(defaultList, defaultNumb)
set currentName to getAt(currentDefault,1)
set currentBid to getAt(currentDefault,2)
add (masterlist, [currentArtistCode, currentName, currentBid])
end repeat
end repeat
--This statement sets the keyDownScript to the handler "tallyBid" so
-- that whenever a key is pressed the "tallyBid" handler is executed.
set the keyDownScript = "tallyBid"
--This statement allows sprite 22 to respond immediately when clicked
--rather than waiting for a mouseup
set the immediate of sprite 22 = TRUE
-- We use a special cursor that is stored as a castmember. The cast member
--is a 16 x 16 pixel, 1 bit cast member.
set magcursor to [the number of cast "magnifying glass"]
-- set the cursor of each hot spot sprite to this special cursor.
-- its cast number is stored in the variable magcursor
-- menu bar
set the cursor of sprite 2 = magcursor
-- large designer name sprite
set the cursor of sprite 3 = magcursor
-- small booth icon sprites
set the cursor of sprite 5 = magcursor
set the cursor of sprite 6 = magcursor
set the cursor of sprite 7 = magcursor
set the cursor of sprite 8 = magcursor
set the cursor of sprite 9 = magcursor
set the cursor of sprite 10 = magcursor
-- small furniture icons
set the cursor of sprite 12 = magcursor
set the cursor of sprite 13 = magcursor
set the cursor of sprite 14 = magcursor
set the cursor of sprite 15 = magcursor
-- large furniture icons
set the cursor of sprite 16 = magcursor
set the cursor of sprite 17 = magcursor
-- enter bid sprite
set the cursor of sprite 22 = magcursor
end startMovie
-- *********************************************************************
-- The stopMovie handler is called automatically when the movie is stopped
on stopMovie
--This statement turns the cursor back to the arrow cursor when the movie
--is stopped.
cursor (-1)
end stopMovie
-- *********************************************************************
-- called when the user clicks on the Designer Name Sprite (channel 3)
-- the handler determines the vertical position of the mouse and deduces the
-- designer name that was clicked. Then it moves the playback head to
-- the frame in the score that represents that designer.
on designerNameClick
put "" into field "name entry field"
put "" into field "bid entry field"
put the mouseV into VertPos
if VertPos > 56 and VertPos < 210 then
if VertPos > 185 then
-- Designer Ohashi
go "Oha0"
else
if VertPos > 163 then
-- Designer Kane
go "Kane0"
else
if VertPos >136 then
-- Designer Graham
go "Grah0"
else
if VertPos > 108 then
-- Designer Gee
go "Gee0"
else
if VertPos > 83 then
-- Designer Brayton
go "Bray0"
else
-- Designer Belschner
go "Bel0"
end if
end if
end if
end if
end if
end if
end designerNameClick
-- *********************************************************************
-- called when the user clicks the Menu Bar Sprite (channel 2)
-- the handler determines the horizontal position of the mouse and deduces the
-- menu item that was clicked. Then it calls the appropriate movie.
on bartender
put the mouseH into HortPos
if HortPos < 123 then
-- furniture menu item clicked
play movie "FURNITUR.DIR"
else
if HortPos < 273 then
-- philanthropy menu item clicked
play movie "PHILANTH.DIR"
else
if HortPos < 385 then
-- learning menu item clicked
play movie "LEARN.DIR"
else
if HortPos < 440 then
-- luck menu item clicked
play movie "LUCK.DIR"
else
-- help menu item clicked
play movie "HELP.DIR"
end if
end if
end if
end if
end bartender
-- *********************************************************************
-- This handler is used to accept a bid for a given designer. The bid is
--added to the master list
-- *********************************************************************
on acceptBid currentArtist
global masterList
put the text of field "bid entry field" into theBid
put the text of field "name entry field" into theName
--These statements send the movie to the help screens for bid entry
--if the user enters a blank in either the bid or name fields.
--If the user has entered something in both these fields, then
--these statements accept the bid and enter the bid into the master list.
if theBid = "" or theName = "" then
go the frame + 1
else
--this statement adds the name and bid entered by the user along with
--the name of the current desinger to the master list
add(masterList,[currentArtist,theName,value(theBid)])
put EMPTY into field "name entry field"
put EMPTY into field "bid entry field"
go to the frame -1
end if
end acceptBid
-- *********************************************************************
-- This handler is used to tally all bids for all designers
-- The highest bid for each designer will selected as the winner
-- of the bidding. A list of the winners will be prepared for display
--on the stage and the user presses the "=" key.
-- *********************************************************************
on tallyBid
global masterList, artistList, eachArtistList
--These statements stop the passage of the event if the
--user has pressed the Return key, causing the Return key to have no
--effect.
if the key = RETURN then
dontPassEvent
end if
-- These statements tally the bids if the user has pressed the "="key.
if the key = "=" then
dontPassEvent
set eachArtistList to []
set winnerList to []
--These statements step through each artist in the artistList and extract
--from the master list, a list called "eachArtistList"
--that contains all the bids for that artist.
repeat with whichArtist = 1 to count(artistList)
--These statements determine which artist we are compiling a
--list for this time through the loop.
set thisArtistRecord to getAt(artistList, whichArtist)
set eachArtistList to []
set thisArtist to getAt(thisArtistRecord,2)
--These statements repeat through master list and see if
--the current artist matches the artist listed in the master list.
--If the artist does match the artist listed in a record of the master
--list, then that record from the master list is appended to the
--list "eachArtistList"
repeat with masterRecord = 1 to count(masterList)
set currentMasterRecord to getAt(masterList, masterRecord)
set currentArtist to getAt(currentMasterRecord,1)
if currentArtist = thisArtist then
append(eachArtistList,currentMasterRecord)
end if
end repeat
--These statements extract the maximum bid from the lists
--eachArtistList.
set firstArtistRecord to getAt(eachArtistList, 1)
set maxBid to getAt(firstArtistRecord,3)
repeat with eachArtistRecord=1 to count(eachArtistList)
set currentArtistRecord to getAt(eachArtistList,eachArtistRecord)
set currentBid to getAt(currentArtistRecord,3)
--These statements set maxBid to the larger of either the current
--list member or the previous bid.
if currentBid > maxBid then
set maxBid to currentBid
set maxArtistRecord to currentArtistRecord
end if
end repeat
--This statement appends the maximum bid for the current artist
--to the list called "winnerlist". The winner list should always have
--one winner for each artist and therefore a number of members equal to
--the number of artists.
append(winnerList,maxArtistRecord)
end repeat
--We have now finished compiling a list called winnerList that contains
--the winning bid amount and the bid winner name for each artist.
--These statements erase whatever is in the fields used
--to display the winners.
put EMPTY into field "display winner names"
put EMPTY into field "display winning bids"
--These statements step through the winner list to compile
--a text cast member called "display winner names" that contains
--the winner names, winning bids, and descriptive text.
repeat with m = 1 to count(winnerList)
set currentwinner to getAt(winnerList, m)
set nameDisplay to getAt(currentwinner,2)
set bidDisplay to getAt(currentwinner, 3)
put "The winning bid is $" & bidDisplay && "by" && nameDisplay & RETURN & RETURN after¼
field "display winner names"
end repeat
go "showAucRes"
end if
end
-- *********************************************************************
-- Basic handler used when this moive is played in a window.
-- Provides a way to reset the movie.
on resetMovie
play movie "Begin.DIR"
end resetMovie